![]() Running CFM-68K Code at Interrupt Time: Is Your Code at Risk?By Karen WenzelApple CFM Team wenzel@apple.com |
CONTENTSDefining the ProblemExamples of Risky Code Summary |
Running CFM-68K code at interrupt time is a risky business for Apple developers.
If Code Fragment Manager-68K code does run at interrupt time, it can cause an
invalid A5 register value for some classic 68K code that executes after the interrupt.
Though documented in the Release notes on E.T.O #21, some developers may not be
aware of the limitation, i.e., running CFM-68K code at interrupt time. This
limitation exists in all versions of CFM-68K and therefore only applies to code
running on 68K machines. Developers may assume that all code that runs on the
PowerPC when ported to CFM-68K should run equally well on 68K machines. In the
case of code that runs in interrupt time, however, this is not true.
If you are developing or using CFM-68K code, you should read this Technote to determine if your code is at risk. |
Defining the ProblemThe problem occurs when CFM-68K code is running and an interrupt causes CFM-68K code to be invoked. As a consequence, the value of the classic A5 register may be destroyed. The problem involves the 68K version of Mixed Mode and its interaction with the interrupt system. During execution of CFM-68K code, Mixed Mode maintains an A5 value for classic 68K code. If an interrupt occurs in which CFM-68K code executes, Mixed Mode's A5 value that is held for classic code will get destroyed. When the classic code resumes execution, its A5 register value is invalid and all subsequent A5-relative references also become invalid (e.g., global data references). As result, the classic 68K code will most likely crash your system. |
Note: This problem does not exist on the PowerPC due to the integration of interrupts and Mixed Mode by a nanokernel. |
Examples of Risky CodeThe following are examples of interrupt (exception)-time execution during which CFM-68K code must not be executed:
If you are a provider of a classic 68K service -- e.g., a static library -- whose implementation uses CFM-68K code, you should document this fact for your clients. Your clients need to be aware that your services cannot be invoked at interrupt time. |
Apple currently does not support the use of CFM-68K code at interrupt time. For those developers who want to use CFM-68K code at interrupt time, Apple is working on a solution. Future versions of CFM-68K may support some use of CFM-68K code at interrupt time. If you are currently using CFM-68K code at interrupt time, you need to take the necessary steps to only use classic 68K code at interrupt time.
![]() ![]() |
Thanks to Erik Eidt, Jeff Cobb, Alan Lillich, Allan Foster, David Gaxiola, Pete Gontier, Peri Frantz, and Tim Swihart.
Tech Support
Technotes
Previous Technote |
Contents
Main| Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help